<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>项目-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<link rel="stylesheet" href="__PUBLIC__/mobile/css/dropload.css">
</head>
<body style="background: #f3f3f3;">
<div class="header">
	<a href="__APP__/Mobile/Index/index" class="back_btn"></a>
	会议纪要
</div>
<div class="content">
    <div class="project_list">
        <ul>
			<foreach name="result" item="vo">
            <li>
				<a href="__APP__/Mobile/Index/meeting_minutes_detail/id/{$vo['id']}">
                    <div class="time">{$vo['meeting_num']}<span>|</span>{$vo['date']}</div>
                    <div class="name">{$vo['module']['module_name']}</div>
                    <div class="user"><span>会议地点：{$vo['meeting_address']}</span></div>
                </a>
            </li>
			</foreach>
        </ul>
    </div>
</div>
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/dropload.min.js"></script>
<script>
    $(function(){
        $(".back_btn").click(function(){sessionStorage.clear();});
        var $now = 1;
        //输出本地存储now
        var $storage_now = sessionStorage.getItem("storage_now");
        if($storage_now){
            $now = parseInt($storage_now);
        }
        var page = 6,
            $count = "{$count}",
            max = Math.ceil(parseInt($count)/page);

        $('.content').dropload({
            scrollArea : window,
            loadDownFn : function(me){
                if($now<max){
                    var center_id = "{$center_id}",
						p_type = "{$p_type}",
						sj = "{$sj}",
						keyword = "{$keyword}",
						html = '',
                        $start_count = page*$now;
                    $.ajax({
                        type: 'POST',
                        async:false,
				        dataType:"json",
                        data:{"center_id":center_id,"p_type":p_type,"keyword":keyword,"start_size":$start_count,"start_page":page},
                        url:"__APP__/Mobile/Index/meeting_minutes_ajax",
                        dataType: 'json',
                        success: function(data){
                            if(data){
                                for(var i=0; i<data.length; i++){
                                    html += '<li>';
									html += '<a href="__APP__/Mobile/Index/meeting_minutes_detail/id/'+data[i].id+'">';
                                    html += '<div class="time">'+data[i].meeting_num+'<span>|</span>'+data[i].date+'</div>';
                                    html += '<div class="name">'+data[i].module.module_name+'</div>';
                                    html += '<div class="user"><span>会议地点：'+data[i].meeting_address+'</div>';
                                    html += '</a>';
                                    html += '</li>';
                                }
                            }
                            $now++;
                            //保存本地存储
                            var $get_str_after = sessionStorage.getItem("storage_str"),
                                $storage_str = "";

                            if($get_str_after){
                                $storage_str += $get_str_after.replace(/^\[|\]$/g,"")+",";
                            }
                            $storage_str += JSON.stringify(data).replace(/^\[|\]$/g,"");
                            $storage_str = "["+$storage_str+"]";
                            sessionStorage.setItem("storage_str",$storage_str);
                            sessionStorage.setItem("storage_now",$now);
                            $('.project_list ul').append(html);
                            me.resetload();
                        },
                        error: function(xhr, type){
                            alert('Ajax error!');
                            // 即使加载出错，也得重置
                            me.resetload();
                        }
                    });
                }else{
                    me.lock();
                    me.noData();
                    me.resetload();
                }
            }
            
        });
        
    })
    $(window).scroll(function(){
        //保存滚动条位置
        var $storage_top = $(window).scrollTop();
        sessionStorage.setItem("storage_top",$storage_top);
    });
    $(function(){
        var $get_str_before = sessionStorage.getItem("storage_str"),
            $storage_top = sessionStorage.getItem("storage_top");

        if($get_str_before){
            var $data = JSON.parse($get_str_before),
				$center_id = "{$center_id}",
				$sj = "{$sj}",
                $html = "";
           
            for(var i=0;i<$data.length;i++){
                $html += '<li>';
				$html += '<a href="__APP__/Mobile/Index/meeting_minutes_detail/id/'+$data[i].id+'">';
                $html += '<div class="time">'+$data[i].meeting_num+'<span>|</span>'+$data[i].date+'</div>';
                $html += '<div class="name">'+$data[i].module.module_name+'</div>';
                $html += '<div class="user"><span>会议地点：'+$data[i].meeting_address+'</div>';
                $html += '</a>';
                $html += '</li>';
            }
            $('.project_list ul').append($html);
        }

        if($storage_top){
            $(window).scrollTop($storage_top);
        }
    })
</script>
</body>
</html>